
<?

function slice_2d_array_by_max_item($array)
{




    foreach ($array as $k => $v)
    {

        if(count(array_filter($v)))
        {
            $list[]=$v;

            //计算出最长数组的key值
            foreach ($list as $k2=>$v2)
            {
                $maxKey = 0;

                $v2=array_filter($v2);

                foreach( $v2 as $k3 => $v3 ) {

                    if( $k3 > $maxKey ) {

                        $maxKey = $k3;

                    }

                }
            }


            $clean_array[]=array_slice($v,0,$maxKey+1);




        }




    }






return $clean_array;









}
?>